﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/admin.Master" CodeBehind="Domains.aspx.cs"
    Inherits="LiveWebServiceAdmin.Domains1" %>

<asp:Content ContentPlaceHolderID="MenuContent" ID="PageType" runat="server">
    <p>
        4</p>
</asp:Content>
<asp:Content ContentPlaceHolderID="TopContent" ID="PageInfo" runat="server">
    Live Domains
    <br />
    <br />
    Your Domains:
</asp:Content>
<asp:Content ContentPlaceHolderID="TopBannerContent" ID="PageAbout" runat="server">
    Edit Live Domains.
</asp:Content>
<asp:Content ContentPlaceHolderID="BottomBannerContent" ID="Content1" runat="server">
    You can manage your Live@edu domains here.
</asp:Content>
<asp:Content ContentPlaceHolderID="BottomContent" ID="PageMain" runat="server">
    <div id="manageduser">
        <asp:HiddenField ID="hdManagedUser" runat="server" />
    </div>
    <div id="currentorganization">
        <asp:HiddenField ID="hdOrganization" runat="server" />
    </div>
    <div id="currentsite">
        <asp:HiddenField ID="hdSiteid" runat="server" />
    </div>
    <div id="currentaccount">
        <asp:HiddenField ID="hdAccount" runat="server" />
    </div>
    <table id="usertable" width="100%">
        <tr align="center">
            <td colspan="4">
                <asp:ListBox ID="lbUserDomains" runat="server" Height="250px" Width="100%" SelectionMode="Single">
                </asp:ListBox>
            </td>
        </tr>
        <tr align="center">
            <td>
                <a id="newdom" href="javascript:void(0)" title="Create new User Domain" class="thickbox">
                    Add Domain</a>
            </td>
            <td>
                <div id="vieworg">
                    <a href="javascript:void(0)">View Organizations</a>
                </div>
            </td>
            <td>
                <div id="editdom">
                    <a href="javascript:void(0)" title="Edit Organization" class="thickbox">Edit Domain</a>
                </div>
            </td>
            <td>
                <div id="deletedom">
                    <%--<a href="javascript:void(0)" title="Delete Organization" class="thickbox">Delete Domain</a>--%>
                    <asp:Button ID="btnDeleteOrg" CssClass="buttonlink" runat="server" 
                        Text="Delete Domain" onclick="btnDeleteOrg_Click" />
                </div>
            </td>
        </tr>
    </table>
    <div>

        <script language="javascript" type="text/javascript">
            $(document).ready(function() {
                var manageuser = $("#manageduser").find("input").get(0).value;
                var manageorg = $("#currentorganization").find("input").get(0).value;
                var mangesite = $("#currentsite").find("input").get(0).value;
                var mangeac = $("#currentaccount").find("input").get(0).value;

                $("#newdom").attr("href", "/ActionPages/managedomains.aspx?manageuser=" + manageuser + "&manageorganization=" + manageorg + "&managesite=" + mangesite + "&manageaccount=" + mangeac + "&keepThis=true&TB_iframe=true&height=75&width=320");

                $("#vieworg").hide();
                $("#vieworg").find("a").attr("href", "javascript:void(0)");

                $("#editdom").hide();
                $("#editdom").find("a").attr("href", "javascript:void(0)");

                $("#deletedom").hide();
                $("#deletedom").find("a").attr("href", "javascript:void(0)");
            });

            $("#usertable").find("select").click(function(event) {
                var options = $("#usertable").find("option").each(function(index) {
                    if ($(this).attr("selected")) {
                        var manageuser = $("#manageduser").find("input").get(0).value;
                        var manageorg = $("#currentorganization").find("input").get(0).value;
                        var mangesite = $("#currentsite").find("input").get(0).value;
                        var mangeac = $("#currentaccount").find("input").get(0).value;
                        var editeddomain = $(this).text();

                        $("#vieworg").show();
                        $("#vieworg").find("a").attr("href", "/organizations.aspx?manageuser=" + manageuser/* + "&manageorganization=" + manageorg*/);

                        $("#editdom").show();
                        $("#editdom").find("a").attr("href", "/ActionPages/managedomains.aspx?manageuser=" + manageuser + "&manageorganization=" + manageorg + "&managesite=" + mangesite + "&manageaccount=" + mangeac + "&editeddomain=" + editeddomain + "&keepThis=true&TB_iframe=true&height=75&width=320");

                        $("#deletedom").show();
                    }
                }
                );
            });
        </script>

    </div>
</asp:Content>
